home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / pyshared / ibus / notifications.py < prev    next >
Encoding:
Python Source  |  2009-11-05  |  2.1 KB  |  62 lines

  1. # vim:set et sts=4 sw=4:
  2. #
  3. # ibus - The Input Bus
  4. #
  5. # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
  6. #
  7. # This library is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU Lesser General Public
  9. # License as published by the Free Software Foundation; either
  10. # version 2 of the License, or (at your option) any later version.
  11. #
  12. # This library is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU Lesser General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public
  18. # License along with this program; if not, write to the
  19. # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  20. # Boston, MA  02111-1307  USA
  21.  
  22. __all__ = (
  23.         "NotificationsBase",
  24.         "IBUS_SERVICE_NOTIFICATIONS",
  25.         "IBUS_PATH_NOTIFICATIONS"
  26.     )
  27.  
  28. IBUS_SERVICE_NOTIFICATIONS = "org.freedesktop.IBus.Notifications"
  29. IBUS_PATH_NOTIFICATIONS = "/org/freedesktop/IBus/Notifications"
  30.  
  31. import ibus
  32. from ibus import interface
  33.  
  34. class NotificationsBase(ibus.Object):
  35.     def __init__(self, bus):
  36.         super(NotificationsBase, self).__init__()
  37.         self.__proxy = NotificationsProxy(self, bus.get_dbusconn())
  38.  
  39.     def notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
  40.         pass
  41.  
  42.     def close_notification(self, id):
  43.         pass
  44.  
  45.     def notification_closed(self, id, reason):
  46.         self.__proxy.NotificationClosed(id, reason)
  47.  
  48.     def action_invoked(self, id, action_key):
  49.         self.__proxy.ActionInvoked(id, action_key)
  50.  
  51. class NotificationsProxy(interface.INotifications):
  52.     def __init__ (self, notify, dbusconn):
  53.         super(NotificationsProxy, self).__init__(dbusconn, IBUS_PATH_NOTIFICATIONS)
  54.         self.__dbusconn = dbusconn
  55.         self.__notify = notify
  56.     
  57.     def Notify(self, replaces_id, app_icon, summary, body, actions, expire_timeout):
  58.         return self.__notify.notify(replaces_id, app_icon, summary, body, actions, expire_timeout)
  59.     
  60.     def CloseNotification(self, id):
  61.         return self.__notify.close_notification(id)
  62.